home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / win_q_t / trem.zip / INIT.C < prev    next >
Text File  |  1991-05-11  |  3KB  |  103 lines

  1. /************************************************************************
  2.  *
  3.  *    Copyright (c) 1991 Microsoft Corporation.  All Rights Reserved.
  4.  *
  5.  *-----------------------------------------------------------------------
  6.  *
  7.  *     Project:  Windows Terminal Example
  8.  *
  9.  *      Module:  init.c
  10.  *
  11.  *      Author:  Bryan A. Woodruff (baw)
  12.  *
  13.  *
  14.  *     Remarks:  Initialization routines
  15.  *
  16.  *   Revisions:  
  17.  *     01.00.000  5/ 9/91 baw   Wrote it
  18.  *
  19.  ************************************************************************/
  20.  
  21. #include "terminal.h"
  22.  
  23. /************************************************************************
  24.  *  BOOL InitApplication( HANDLE hInstance )
  25.  *
  26.  *  Description:
  27.  *     First time initialization stuff.  This registers information
  28.  *     such as window classes.
  29.  *
  30.  *  Comments:
  31.  *      5/ 8/91  baw  Wrote it
  32.  *
  33.  ************************************************************************/
  34.  
  35. BOOL InitApplication( HANDLE hInstance )
  36. {
  37.    WNDCLASS  wndclass ;
  38.  
  39.    // register terminal window class
  40.  
  41.    wndclass.style =         NULL ;
  42.    wndclass.lpfnWndProc =   TerminalWndProc ;
  43.    wndclass.cbClsExtra =    0 ;
  44.    wndclass.cbWndExtra =    sizeof( WORD ) ;
  45.    wndclass.hInstance =     hInstance ;
  46.    wndclass.hIcon =         LoadIcon( hInstance, szAppName ) ;
  47.    wndclass.hCursor =       LoadCursor( NULL, IDC_ARROW ) ;
  48.    wndclass.hbrBackground = GetStockObject( WHITE_BRUSH ) ;
  49.    wndclass.lpszMenuName =  szTerminalMenu ;
  50.    wndclass.lpszClassName = szTerminalClass ;
  51.  
  52.    return( RegisterClass( &wndclass ) ) ;
  53.  
  54. } /* end of InitApplication() */
  55.  
  56. /************************************************************************
  57.  *  BOOL InitInstance( HANDLE hInstance, int nCmdShow, HWND *phwndApp )
  58.  *
  59.  *  Description:
  60.  *     Initializes instance specific information.
  61.  *
  62.  *  Comments:
  63.  *      5/ 8/91  baw  Wrote it
  64.  *
  65.  ************************************************************************/
  66.  
  67. BOOL InitInstance( HANDLE hInstance, int nCmdShow, HWND *phwndApp )
  68. {
  69.    HWND  hwndApp ;
  70.  
  71.    // store instance handle
  72.    hAppInst = hInstance ;
  73.  
  74.    // store version number
  75.    wsprintf( szVersion, "%02d.%02d.%03d", VER_MAJOR, VER_MINOR, VER_BUILD ) ;
  76.  
  77.    // load accelerators
  78.    hAccel = LoadAccelerators( hInstance, szTerminalAccel ) ;
  79.  
  80.    // create the Terminal window
  81.    hwndApp = CreateWindow( szTerminalClass, szAppName,
  82.                            WS_OVERLAPPEDWINDOW,
  83.                            CW_USEDEFAULT, CW_USEDEFAULT,
  84.                            CW_USEDEFAULT, CW_USEDEFAULT,
  85.                            NULL, NULL, hInstance, NULL ) ;
  86.  
  87.    if (NULL == hwndApp)
  88.       return ( FALSE ) ;
  89.  
  90.    ShowWindow( hwndApp, nCmdShow ) ;
  91.    UpdateWindow( hwndApp ) ;
  92.  
  93.    *phwndApp = hwndApp ;
  94.  
  95.    return ( TRUE ) ;
  96.  
  97. } /* end of InitInstance() */
  98.  
  99. /************************************************************************
  100.  * End of File: init.c
  101.  ************************************************************************/
  102.  
  103.